export function minNumberOfHours(initialEnergy: number, initialExperience: number, energy: number[], experience: number[]): number {
    let rst: number = 0;
    for(let i = 0; i < energy.length; i++) {
        if(initialEnergy <= energy[i]) {
            rst += energy[i] - initialEnergy + 1;
            initialEnergy = energy[i] + 1;
        }
        if(initialExperience <= experience[i]) {
            rst += experience[i] - initialExperience + 1;
            initialExperience = experience[i] + 1;
        }
        initialEnergy -= energy[i];
        initialExperience += experience[i];
    }
    return rst;
}

